﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vds2465Telegrams
{
	public enum eConnectionPath
    {
        /// <summary>
        /// 0x08
        /// </summary>
		ConnectThroughRequest = 0x08,

        /// <summary>
        /// 0x10
        /// </summary>
		CallbackRequest = 0x10,

        /// <summary>
        /// 0x18
        /// </summary>
		CallbackExecution = 0x18,

        /// <summary>
        /// 0x80
        /// </summary>
		ConnectThroughExecuted = 0x80,
    }

	public class UserData_48_ConnectionPath : UserData
	{
		#region private member variables

		private readonly eConnectionPath _connectionPath;

		#endregion private member variables

		#region constructor

		public UserData_48_ConnectionPath(eConnectionPath connectionPath)
			: base(UserData.UserData48ConnectionPath)
		{
			_connectionPath = connectionPath;
		}

		#endregion constructor

		#region getters

		public eConnectionPath ConnectionPath { get { return _connectionPath; } }

		#endregion getters

		#region ToString, Equals, GetHashCode

		public override int GetHashCode()
		{
			int hashCode = base.GetHashCode();
			hashCode ^= (byte)ConnectionPath;

			return hashCode;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("(");
			stringBuilder.Append(ToStringProperties());
			stringBuilder.Append(")");

			return stringBuilder.ToString();
		}

		internal override string ToStringProperties()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(base.ToStringProperties());

			stringBuilder.Append(", ");

			stringBuilder.Append("ConnectionPath='");
			stringBuilder.Append(ConnectionPath);
			stringBuilder.Append("'");

			return stringBuilder.ToString();
		}

		public override bool Equals(object obj)
		{
			Type objType = obj.GetType();
			if (this.GetType() == objType)
			{
				UserData_48_ConnectionPath userData2Compare = obj as UserData_48_ConnectionPath;
				return EqualsProperties(userData2Compare);
			}

			return false;
		}

		internal bool EqualsProperties(UserData_48_ConnectionPath userData2Compare)
		{
			if (base.EqualsProperties(userData2Compare))
			{
				return (ConnectionPath == userData2Compare.ConnectionPath);
			}

			return false;
		}

		#endregion ToString, Equals, GetHashCode
	}
	
}
